package com.mfh.auto.create.mvvm.autocreatemvvm.utils

object CommonUtils {

    /**
     * 驼峰转下划线
     */
    fun camelToUnderscore(camelCase: String): String {
        return buildString {
            camelCase.forEachIndexed { index, char ->
                if (char.isUpperCase()) {
                    if (index > 0) append('_')
                    append(char.lowercaseChar())
                } else {
                    append(char)
                }
            }
        }
    }
}